Structured programming is a programming methodology in which programs are written using control structures and basic blocks. The control structures, which include conditional branches and loops, determine the flow of control through a program during execution of the program.
Correct programming requires adherence to grammatical rules of a selected programming language. Control structures are opened and closed according to the syntactic rules of the programming language.
Failing to balance a control structure opening statement with a corresponding closing statement can also cause a program not to execute as expected.
To facilitate understanding of a program, indentation is usually used to illustrate statements that fall within a conditional statement of a loop.
Modern programming environments, often referred to as integrated development environments (IDE) or integrated programming environments (IPE) (herein, the abbreviation “IDE” is used to include both IDE and IPE), provide program entry and editing tools that automate many tasks of a programmer. One example is the automatic indentation of program code as the code is entered by a programmer or read from program memory.
On large screens, such as found on computer workstations as well as modern notebook computers and tablets, windows displaying program code can usually be expanded to sufficient width to accommodate code that has a high level of nesting of control structures and that has the associated deep indentation. However, on smaller screens, for example, hand-held devices such as on programmable calculators, the indentation presents a problem. If a program contains lines that extend beyond the right edge of the device screen, the line is typically either wrapped to the next line, or the display screen can be scrolled horizontally to allow a reader to read the entire line. Both solutions cause a loss of readability of the program and defeat the purpose of indenting the code for readability.